package pl.edu.agh.neuraleconomy.model.simulation;

import java.math.BigDecimal;
import java.util.Date;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import pl.edu.agh.neuraleconomy.model.base.BaseModel;
import pl.edu.agh.neuraleconomy.model.exchange.Company;

import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName = "transaction")
@Data
@EqualsAndHashCode(callSuper = false)
@AllArgsConstructor
@NoArgsConstructor
@ToString(exclude = {"simulation"})
public class Transaction extends BaseModel{
	public final static String SIMULATION_ID = "simulation_id";
	public final static String DATE = "date";
	
	@DatabaseField(canBeNull = false, dataType = DataType.ENUM_STRING)
	protected TransactionType type;
	@DatabaseField(canBeNull = false, foreign = true, index = true, foreignAutoRefresh= true)
	protected Company company;
	@DatabaseField(canBeNull = false)
	protected int amount;
	@DatabaseField(canBeNull = false, dataType = DataType.DATE)
	protected Date date;
	@DatabaseField(canBeNull = false, index = true, foreign = true, foreignAutoRefresh = true)
	protected Simulation simulation;
	@DatabaseField
	protected BigDecimal price;
}
